/**
 * @description 获取系统相关设置
 */
import api from '@/api'

const state = () => ({
  sys_setting: {},
})
const getters = {
  sys_setting: (state) => state.sys_setting,
}
const mutations = {
  /**
   * @description 设置setting
   * @param {*} state
   * @param {*} token
   */
  setSetting(state, sys_setting) {
    state.sys_setting = sys_setting
  },
}
const actions = {
  /**
   * @description 获取系统接口 这个接口非常非常重要，如果没有明确底层前逻辑禁止修改此方法，错误的修改可能造成整个框架无法正常使用
   * @param {*} { commit, dispatch, state }
   * @returns
   */
  async getSetting({ commit }) {
    const { data } = await api.common.setting()
    commit('setSetting', data)
  },
}
export default { state, getters, mutations, actions }
